﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Style TargetType="{x:Type Button}">
        <Setter Property="Background" Value="{DynamicResource ButtonBackgroundThemeBrush}" />
        <Setter Property="Foreground" Value="{DynamicResource ButtonForegroundThemeBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource ButtonBorderThemeBrush}" />
        <Setter Property="BorderThickness" Value="{DynamicResource ButtonBorderThemeThickness}" />
        <Setter Property="Padding" Value="12,4,12,4" />
        <Setter Property="HorizontalAlignment" Value="Center" />
        <Setter Property="VerticalAlignment" Value="Center" />
        <Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
        <Setter Property="FontWeight" Value="SemiBold" />
        <Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid SnapsToDevicePixels="True">
                        <Border x:Name="Border" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Margin="3">
                            <ContentControl x:Name="ContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}"  Content="{TemplateBinding Content}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                            Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                        </Border>
                        <Rectangle x:Name="FocusVisualWhite" IsHitTestVisible="False" Opacity="0"  StrokeEndLineCap="Square" Stroke="{DynamicResource FocusVisualWhiteStrokeThemeBrush}" />
                        <Rectangle x:Name="FocusVisualBlack" IsHitTestVisible="False" Opacity="0"  StrokeEndLineCap="Square" Stroke="{DynamicResource FocusVisualBlackStrokeThemeBrush}" />
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource ButtonDisabledBackgroundThemeBrush}" />
                            <Setter TargetName="Border" Property="BorderBrush" Value="{DynamicResource ButtonDisabledBorderThemeBrush}" />
                            <Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource ButtonDisabledForegroundThemeBrush}" />
                        </Trigger>
                        <Trigger Property="IsFocused" Value="True">
                            <Setter TargetName="FocusVisualWhite" Property="Opacity" Value="1" />
                            <Setter TargetName="FocusVisualBlack" Property="Opacity" Value="1" />
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource ButtonPointerOverBackgroundThemeBrush}" />
                            <Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource ButtonPointerOverForegroundThemeBrush}" />
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource ButtonPressedBackgroundThemeBrush}" />
                            <Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource ButtonPressedForegroundThemeBrush}" />
                        </Trigger>
                        <Trigger Property="ToggleButton.IsChecked" Value="True">
                            <Setter TargetName="Border" Property="Background" Value="{DynamicResource ButtonPressedBackgroundThemeBrush}" />
                            <Setter TargetName="ContentPresenter" Property="Foreground" Value="{DynamicResource ButtonPressedForegroundThemeBrush}" />
                        </Trigger>
                        <Trigger Property="Validation.HasError" Value="True">
                            <Setter TargetName="FocusVisualWhite" Property="Opacity" Value="1" />
                            <Setter TargetName="FocusVisualBlack" Property="Opacity" Value="1" />
                            <Setter TargetName="FocusVisualWhite" Property="Stroke" Value="{DynamicResource ControlValidationInvalidThemeBrush}" />
                            <Setter TargetName="FocusVisualBlack" Property="Stroke" Value="{DynamicResource ControlValidationInvalidThemeBrush}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>